import * as constants from '../Constants'
import { get, GET_SCM_BAND_LIST, GET_BAND_BY_ID } from '../../service/api'


export interface GetBandList {
  type: constants.GetBandList
  payload: Promise<any>
}

export interface GetBandList_PENDING {
  type: constants.GetBandList_PENDING
  payload: Promise<any>
}

export interface GetBandList_FULFILLED {
  type: constants.GetBandList_FULFILLED
  payload: any
}

export interface GetBandList_PAGE {
  type: constants.GetBandList_PAGE
  payload: any
}

export interface RECORD_BAND {
  type: constants.RECORD_BAND
  payload: Promise<any>
}
export interface RECORD_BAND_FULFILLED {
  type: constants.RECORD_BAND_FULFILLED
  payload: any
}

export type BandAction = GetBandList | 
  GetBandList_FULFILLED | 
  GetBandList_PENDING | 
  GetBandList_PAGE |
  RECORD_BAND |
  RECORD_BAND_FULFILLED


export function GetBandList(param: any): GetBandList {
  return {
    type: constants.GetBandList,
    payload: get(GET_SCM_BAND_LIST, param)
  }
}
export function recordBand(param: any): RECORD_BAND {
  return {
    type: constants.RECORD_BAND,
    payload: get(GET_BAND_BY_ID, param)
  }
}
export function clearBand(): RECORD_BAND_FULFILLED {
  return {
    type: constants.RECORD_BAND_FULFILLED,
    payload: {}
  }
}
export function page(page: any): GetBandList_PAGE {
  return {
    type: constants.GetBandList_PAGE,
    payload: page
  }
}